<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>gausstrig</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="gaussi.html" title="gaussi" />
    <link rel="next" href="gbuzz.html" title="gbuzz" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">gausstrig</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="gaussi.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="gbuzz.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="gausstrig"></a>
      <div class="titlepage"></div>
      <a id="IndexGausstrig" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">gausstrig</span>
        </h2>
        <p>gausstrig — 
      Random impulses around a certain frequency.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp112466992"></a>
        <h2>Description</h2>
        <p>
      Generates random impulses around a certain frequency.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp112468288"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ares <span class="command"><strong>gausstrig</strong></span> kamp, kcps, kdev [, imode] [, ifrst1]</pre>
        <pre class="synopsis">kres <span class="command"><strong>gausstrig</strong></span> kamp, kcps, kdev [, imode] [, ifrst1]</pre>
      </div>
      <div class="refsect1">
        <a id="idp112471904"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>imode</em></span> (optional, default=0) -- imode &gt; 0
      means better frequency modulation. If the frequency changes, the
      delay before the next impulse is calculed again. With the
      default mode we have the classic behavior of the GaussTrig ugen
      in SuperCollider, where the frequency modulation is bypassed
      during the delay time that precedes the next impulse.
    </p>
        <p>
      <span class="emphasis"><em>ifrst1</em></span> (optional, default=0) -- ifrst1 &gt; 0
      changes the original behavior of the GuassTrig ugen. By default, it
      always generates an impulse in the very beginning. Otherwise, the first
      impulse appearance is random and depends on <span class="emphasis"><em>kcps</em></span> and
      <span class="emphasis"><em>kdev</em></span> parameters.</p>
      </div>
      <div class="refsect1">
        <a id="idp112476272"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kamp</em></span> -- amplitude.
    </p>
        <p>
      <span class="emphasis"><em>kcps</em></span> -- the mean frequency over which random impulses are distributed.
    </p>
        <p>
      <span class="emphasis"><em>kdev</em></span> -- random deviation from mean (0 &lt;= dev &lt; 1).
    </p>
      </div>
      <div class="refsect1">
        <a id="idp112479856"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the gausstrig opcode. It uses the file <a class="ulink" href="examples/gausstrig.csd" target="_top"><em class="citetitle">gausstrig.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp112481632"></a>
          <p class="title">
            <strong>Example 344. Example of the gausstrig opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac     <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o oscil.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1

<span class="oblock">instr</span> 1

kdev <span class="opc">line</span> 0, p3, 0.9
<span class="ohdr">seed</span> 20120125
aimp <span class="opc">gausstrig</span> 0.5, 10, kdev
aenv <span class="opc">filter2</span> aimp, 1, 1, 0.993, 0.993
anoi <span class="opc">fractalnoise</span> 0.2, 1.7
al   <span class="op">=</span> anoi<span class="op">*</span>aenv
ar   <span class="opc">delay</span> al, 0.02
<span class="opc">outs</span> al, ar

<span class="oblock">endin</span>
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">i</span>1 0 10
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
        <p>
      Here is an example of the gausstrig opcode with imode = 1. It uses the file <a class="ulink" href="examples/gausstrig-2.csd" target="_top"><em class="citetitle">gausstrig-2.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp112487008"></a>
          <p class="title">
            <strong>Example 345. Example of the gausstrig opcode with imode = 1.</strong>
          </p>
          <div class="example-contents">
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac     <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o oscil.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1

<span class="oblock">instr</span> 1

kfrq0 <span class="opc">oscil</span> 8, 0.25, 1
ktrig <span class="opc">metro</span> 1
kfrq  <span class="opc">samphold</span> kfrq0<span class="op">+</span>8, ktrig 
<span class="ohdr">seed</span>  20120125
aimp  <span class="opc">gausstrig</span> 0.5, kfrq, 0.5, 1
aenv  <span class="opc">filter2</span> aimp, 1, 1, 0.993, 0.993
anoi  <span class="opc">fractalnoise</span> 0.2, 1.7
al    <span class="op">=</span> anoi<span class="op">*</span>aenv
ar    <span class="opc">delay</span> al, 0.02
<span class="opc">outs</span>  al, ar

<span class="oblock">endin</span>
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">f</span>1 0 8192 10 1
<span class="stamnt">i</span>1 0 16
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp112488976"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="dust.html" title="dust"><em class="citetitle">dust</em></a>
      <a class="link" href="dust2.html" title="dust2"><em class="citetitle">dust2</em></a>
      <a class="link" href="mpulse.html" title="mpulse"><em class="citetitle">mpulse</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp112492944"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Based on Bhob Rainey's GaussTrig ugen (SuperCollider)</td>
          </tr>
          <tr>
            <td>Author: Tito Latini</td>
          </tr>
          <tr>
            <td>January 2012</td>
          </tr>
          <tr>
            <td>Modification: Gleb Rogozinsky</td>
          </tr>
          <tr>
            <td>March 2015</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in Csound version 5.16</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="gaussi.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="gbuzz.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">gaussi </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> gbuzz</td>
        </tr>
      </table>
    </div>
  </body>
</html>
